﻿
using System;
namespace PronosGestor
{
    // Représente l'ensemble des 3 cotes d'un match (1, N, 2)
    public class Cote
    {
        public double Pronos1 { get; set; }
        public double PronosN { get; set; }
        public double Pronos2 { get; set; }

        public Cote()
        {

        }

        public double Cote1
        {
            get
            {
                return Convert.ToDouble(NbPronosTotal / Pronos1);
            }
        }

        public double CoteN
        {
            get
            {
                return Convert.ToDouble(NbPronosTotal / PronosN);
            }
        }

        public double Cote2
        {
            get
            {
                return Convert.ToDouble(NbPronosTotal / Pronos2);
            }
        }

        public void AlimenterCoteSelonPronostic(Resultat unProno)
        {
            switch (unProno.TypeResultat)
            {
                case '1':
                    Pronos1 += 1;
                    break;
                case 'N':
                    PronosN += 1;
                    break;
                case '2':
                    Pronos2 += 1;
                    break;
                default:
                    break;
            }
        }

        private double NbPronosTotal
        {
            get
            {
                return Pronos1 + PronosN + Pronos2;
            }
        }

        public override string ToString()
        {
            return "( " + Cote1 + ", " +
                CoteN + ", " +
                Cote2 + ", " + " )";
        }
    }
}
